package com.common.jane_ai.filter.StrategyImpl;

import com.common.jane_ai.filter.RequestValidationStrategy;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
//直接通过的请求
public class RequestFreeAllowStrategyImpl implements RequestValidationStrategy {

    private static final List<String> FERR_ALLOW_PATTERNS = List.of(
            "/jane/register",// 注册
            "/jane/login",
            "/jane/pdf/ranking"
//            "/jane/chat"
    );

    @Override
    public boolean matching(String Path) {
        if(FERR_ALLOW_PATTERNS.contains(Path)){
            return true;
        }
        return false;
    }

    @Override
    public boolean execute(HttpServletRequest request, HttpServletResponse response) {
        //通行
        log.info("FREE_ALLOW---Acess");
        return true;
    }
}
